package com.tqz.juc.disruptor;

import com.lmax.disruptor.EventHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>事件处理器，相当于消费者
 *
 * @author tianqingzhao
 * @since 2022/2/21 14:15
 */
@Slf4j
public class LongEventHandler implements EventHandler<LongEvent> {
    
    private long serial = 0;
    
    public LongEventHandler(long serial) {
        this.serial = serial;
    }
    
    @Override
    public void onEvent(LongEvent event, long sequence, boolean endOfBatch) throws Exception {
        log.info("消费者-{}:{}", this.serial, event.getValue());
    }
    
}
